import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get_state_manager/src/rx_flutter/rx_disposable.dart';
import 'package:get/get_utils/src/platform/platform.dart';
import 'package:sp_util/sp_util.dart';

///初始化服务
class InitService extends GetxService {
  Future<InitService> init() async {
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp, //只能纵向
    ]);
    if (GetPlatform.isAndroid) {
      SystemUiOverlayStyle systemUiOverlayStyle =
          const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
      SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
    }
    await SpUtil.getInstance();

    return this;
  }
}
